<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="css/lib/bootstrap.min.css"/>
		<script src="js/lib/jquery-1.11.0.js"></script>
		<script src="js/lib/bootstrap.min.js"></script>
		<script src="js/lib/angular.min.js"></script>
		<script src="js/base.js" type="text/javascript" charset="utf-8"></script>
	</head>
	 <style>
	 	body{
			font-size:12px;
		}
		table td:nth-child(even) {

		}
		table tr:nth-child(2) {
			background-color:#f1f1f1;
		}
		input{
			width:280px;
		}
		span{
			width:20px;color:red;display:inline-block;text-align:center;
		}
		#sho{
			width:300px;
			height:50px;
			background:#d9534f;
			opacity:0.8;
			border-radius:8px;
			color:#fff;
			text-align: center;
			font-size:30px;
			position: absolute;
			top:0px;
			left:550px;
			display:none;
		}
	 </style>
	<body ng-app="myApp" ng-controller="customersCtrl">
		<div class="">
			<div id="sho"></div>
		<!--账户信息-->
		<div style="padding:15px 5px 0px 5px;border:3px solid #ccc;margin-bottom:15px">
			<table class="table table-hover">

				<tbody>
					<tr>
						<th colspan="8" style="font-size:26px;color:#337ab7">实名账户信息：</th>
					</tr>
					<tr>
						<td>用户ID:</td>
						<td id="ID"  style="color:green;font-size:20px"></td>
					</tr>
					<tr>
						<td>账户余额:</td>
						<td id="zh"  style="color:red;font-size:20px"></td>
					</tr>
					<tr>
						<td>分润余额：</td>
						<td id="fy" style="color:red;font-size:20px"></td>
					</tr>
					<tr>
						<td>账户积分：</td>
						<td id="jf" style="color:red;font-size:20px"></td>
					</tr>
					<tr>
						<td>账户操作</td>
						<td>
							<a id="jy" href="#">[交易明细]</a>

							<a id="fr" href="onefenrun.html">[分润明细]</a>

							<a href="个人返佣.html">[返佣明细]</a>

							<a href="jifen.html">[积分明细]</a>

							<a href="jiekou.html">[身份证认证]</a>

							<a href="bankcard.html">[银行卡绑定]</a>							
						</td>
					</tr>
					<tr>
						<td colspan="8">

						</td>
					</tr>
				</tbody>
			</table>
		</div>
		<!--获取用户交易明细-->
			<div id="div2" style="padding:15px 5px 0px 5px;border:3px solid #ccc;margin-bottom:15px;display: none;">
			<table class="table table-hover">
				<tbody>
					<tr>
						<th colspan="11" style="font-size:26px;color:#337ab7">个人交易记录：</th>
					</tr>
					<tr style="font-size:15px";>
						<td class="text-center">序号</td>
						<td class="text-center">交易日期</td>
						<td class="text-center">结算通道</td>
						<td class="text-center">手机号码</td>
						<td class="text-center">订单号</td>
						<td class="text-center">交易描述</td>
						<td class="text-center">总金额</td>
						<td class="text-center">结算费率</td>
						<td class="text-center">实际金额</td>
						<td class="text-center">交易类型</td>
						<td class="text-center">交易状态</td>						
					</tr>
					<tr id="show" ng-repeat="item in lists">
						<td class="text-center" id="show1">#{{$index+1}}</td>
						<td class="text-center" id="show9">{{item.createTime}}</td>
						<td class="text-center">{{item.channelname}}</td>
						<td class="text-center">{{item.phone}}</td>
						<td class="text-center" id="show2">{{item.ordercode}}</td>
						<td class="text-center" id="show3">{{item.desc}}</td>
						<td class="text-center" id="show4">{{item.amount | currency:"￥ "}}</td>
						<td class="text-center" id="show5">{{item.rate}}</td>
						<td class="text-center" id="show6">{{item.realAmount | currency:"￥ "}}</td>
						<td class="text-center" class="show7">{{item.type | modify:item.type}}</td>
						<td class="text-center" id="show8">{{item.status | modify2:item.status}}</td>						
					</tr>
					<tr>
						<td colspan="11" id="show01" class="text-center">
							第<input class="form-control" id="ye" ng-init="ye=1" ng-model="ye" style="width:50px;display:inline-block" type="text"/>页
							<button class="btn btn-default" ng-click="xia()">跳转</button>总共{{pageas}}条数据    当前一共{{pagea}}页
							<button class="btn btn-default" ng-click="home()">首页</button>
							<button class="btn btn-default" ng-click="sh()">上一页</button>
							<button class="btn btn-default" ng-click="next()">下一页</button>
							<button class="btn btn-default" ng-click="last(page)">尾页</button>
						</td>
					</tr>
				</tbody>
			</table>
		</div>
		</div>
	</body>
	<script>
		$(function(){
			/*获取实名账户信息*/
				var token = sessionStorage.getItem(key=1)
				console.log(token)
				$.ajax({
					url:window.baseUrl+"user/account/query/"+token,
					type:"GET",
					dataType:"json",
					data:{
					},
					success:function(data){
						console.log(data)
						$("#ID").html(data.result.userId)
						$('#zh').html(data.result.balance+"元")
						$("#fy").html(data.result.rebateBalance+"元")
						$('#jf').html(data.result.coin)
					},
					error:function(data){
						console.log("接口调用失败！")
					}
				})
				/*交易记录查看*/
				$('#jy').click(function(){
					/*$('#div1').hide()*/
					$('#div2').show()
				})
				/*分润记录查看*/
				/*$('#fr').click(function(){
					$('#div2').hide()
					$('#div1').show()
				})*/
		})
	</script>
	<script>
		var app = angular.module('myApp', []);
		app.filter('modify0',function(){
			return function(input,param){
				if(param == "WEIXIN_QRCODE"){
							return param = "微信支付"
						}
						if(param == "ALIPAY_QRCODE"){
							return param = "支付宝支付"
						}
						if(param == "YILIAN"){
							return param = "易联支付"
						}
						if(param == "ZHONGMAO_PAY"){
							return param = "中贸支付"
						}
						if(param == "JIEFUBAO"){
							return param = "京东钱包"
						}
						if(param == "SWIFT_QQ_QRCODE"){
							return param = "qq扫码"
						}
						if(param == "SWIFT_ALIPAY_QRCODE"){
							return param = "支付宝扫码"
						}
						if(param == "SWIFT_WEIXIN_QRCODE"){
							return param = "微信扫码支付"
						}
			}
		})
		/*自定义过滤器   1*/
		app.filter("modify",function(){
			return function(input,param){
				if(param == 0){
					return param = "充值"
				}
				if(param == 1){
					return param = "支付"
				}
				if(param == 2){
					return param = "提现"
				}
				if(param == 3){
					return param = "退单"
				}
				input = param
				return input
			}
		})
		/*自定义过滤器   2*/
		app.filter("modify2",function(){
			return function(input,param){
				if(param == 0){
					return param = "待完成"
				}
				if(param == 1){
					return param = "已成功"
				}
				if(param == 2){
					return param = "已取消"
				}
				if(param == 3){
					return param = "待处理"
				}
				if(param == 4){
					return param = "待结算"
				}
				input = param
				return input
			}
		})
        app.controller('customersCtrl', function($scope, $http){
        	/*根据登陆信息获取token*/
        	var token = sessionStorage.getItem(key=1);
			/*获取用户交易明细*/
				$http({
					method: 'POST',
					params:{size:10,page:0},
					url: window.baseUrl+"transactionclear/payment/query/"+token
				}).then(function successCallback(data){
					console.log("请求交易明细数据成功...")
					console.log(data.data)
					$scope.lists = data.data.result.content;
					$scope.pageas = data.data.result.totalElements;
					$scope.pagea  = data.data.result.totalPages;
					console.log($scope.pageas);
					console.log($scope.pagea);
				}, function errorCallback(data){
						console.log("请求数据失败...")
				     	console.log(data)
				});

				$scope.xia = function(){
					var ye = document.getElementById("ye").value-1;
					$http({
					method: 'POST',
					params:{size:10,page:ye},
					url: window.baseUrl+"transactionclear/payment/query/"+token
					}).then(function successCallback(data){
						console.log("请求交易明细数据成功...")
						console.log(data.data)
						$scope.lists = data.data.result.content
						$scope.pageas = data.data.result.totalElements
						$scope.pagea  = data.data.result.totalPages
						console.log($scope.lists);
						console.log($scope.pageas);
						console.log($scope.pagea);
					}, function errorCallback(data){
							console.log("请求数据失败...")
					     	console.log(data)
					})
				}

				/*回到首页*/
				$scope.home = function(){
					$scope.ye = 1;
                    $http({
                        method:'POST',
                        params:{size:10,page:$scope.ye-1},
                        url: window.baseUrl+"transactionclear/payment/query/"+token
                    }).then(function successCallback(data){
                        console.log("直接或分页查询交易明细成功...")
                        console.log(data.data)
                        $scope.lists = data.data.result.content
                        $scope.pages = data.data.result.totalElements
                        $scope.page  = data.data.result.totalPages
                    }, function errorCallback(data) {
                        console.log("直接或分页查询交易明细失败...")
                        console.log(data)
                    });
				}
				/*到达最后一页*/
				$scope.last = function(page){
				    console.log(page);
                    $http({
                        method:'POST',
                        params:{size:10,page:page-1},
                        url: window.baseUrl+"transactionclear/payment/query/"+token
                    }).then(function successCallback(data){
                        console.log("直接或分页查询交易明细成功...")
                        console.log(data.data)
                        $scope.lists = data.data.result.content
                        $scope.pages = data.data.result.totalElements
                        $scope.page  = data.data.result.totalPages
                    }, function errorCallback(data) {
                        console.log("直接或分页查询交易明细失败...")
                        console.log(data)
                    });
                    $scope.ye = page
				}
				$scope.next = function(){
				   var ye =  $scope.ye+=1;
				   console.log(ye-1)
                    $http({
                        method:'POST',
                        params:{size:10,page:ye-1},
                        url: window.baseUrl+"transactionclear/payment/query/"+token
                    }).then(function successCallback(data){
                        console.log("直接或分页查询交易明细成功...")
                        console.log(data.data)
                        $scope.lists = data.data.result.content
                        $scope.pages = data.data.result.totalElements
                        $scope.page  = data.data.result.totalPages
                    }, function errorCallback(data) {
                        console.log("直接或分页查询交易明细失败...")
                        console.log(data)
                    });
				}
				$scope.sh = function(){
				    var ye = $scope.ye-=1;
				    ye = ye-1;
				    console.log(ye);
				    if(ye <= 0){
				        $scope.ye = 1;
				        console.log(ye)
					}
                    $http({
                        method:'POST',
                        params:{size:10,page:ye},
                        url: window.baseUrl+"transactionclear/payment/query/"+token
                    }).then(function successCallback(data){
                        console.log("直接或分页查询交易明细成功...")
                        console.log(data.data)
                        $scope.lists = data.data.result.content
                        $scope.pages = data.data.result.totalElements
                        $scope.page  = data.data.result.totalPages
                    }, function errorCallback(data) {
                        console.log("直接或分页查询交易明细失败...")
                        console.log(data)
                    });

				}
        })
	</script>
</html>

